package com.itheima.springboot.controller;

import com.itheima.springboot.pojo.User;
import com.itheima.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.annotation.WebServlet;
import java.util.List;

@RestController
@RequestMapping(value = "userController")
//@WebServlet("/userController")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("query")
    public ModelAndView query(){
        ModelAndView modelAndView = new ModelAndView();
        //业务层
        List<User> user = userService.findAll();
        modelAndView.addObject(user);
        modelAndView.setViewName("static/vue.html");
//        return userService.findAll();
        return modelAndView;
    }
}
